// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.

import Vue from 'vue'
import App from './App'
import router from './router'

router.beforeEach((to,from,next) => {
  //路由发生变化时修改页面title
  if (to.meta.title){
    document.title = to.meta.title
  }
  next()
})
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';

Vue.config.productionTip = false

import axios from 'axios'
import VueAxios from 'vue-axios'
Vue.use(VueAxios, axios);

Vue.prototype.$axios = axios
// step2：使每次请求都会带一个 /api 前缀
axios.defaults.baseURL = '/api'

Vue.use(ElementUI);
Vue.config.productionTip = false


/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>',
  render: h => h(App)
})
